/*    */ package com.zimbra.cs.account.callback;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.StringUtil;
/*    */ import com.zimbra.cs.account.AttributeCallback;
/*    */ import com.zimbra.cs.account.Config;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class FreeBusyProviderURLCheck
/*    */   extends AttributeCallback
/*    */ {
/*    */   public void preModify(CallbackContext context, String attrName, Object attrValue, Map attrsToModify, Entry entry)
/*    */     throws ServiceException
/*    */   {
/* 41 */     String value = (String)attrValue;
/* 42 */     if (StringUtil.isNullOrEmpty(value))
/*    */     {
/*    */ 
/* 45 */       return;
/*    */     }
/*    */     
/* 48 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 50 */     if ((attrsToModify.containsKey("zimbraFreebusyExchangeURL")) && (attrsToModify.containsKey("zimbraFreebusyExternalZimbraURL")))
/*    */     {
/* 52 */       throw ServiceException.INVALID_REQUEST("Setting both zimbraFreebusyExchangeURL and zimbraFreebusyExternalZimbraURL is not allowed", null);
/*    */     }
/*    */     
/* 55 */     if (attrsToModify.containsKey("zimbraFreebusyExchangeURL")) {
/* 56 */       String[] zimbraFbExtUrl = prov.getConfig().getFreebusyExternalZimbraURL();
/* 57 */       if ((zimbraFbExtUrl != null) && (zimbraFbExtUrl.length > 0)) {
/* 58 */         throw ServiceException.INVALID_REQUEST("Setting both zimbraFreebusyExchangeURL and zimbraFreebusyExternalZimbraURL is not allowed", null);
/*    */       }
/*    */       
/*    */     }
/* 62 */     else if (attrsToModify.containsKey("zimbraFreebusyExternalZimbraURL")) {
/* 63 */       String exchngFbUrl = prov.getConfig().getFreebusyExchangeURL();
/* 64 */       if (!StringUtil.isNullOrEmpty(exchngFbUrl)) {
/* 65 */         throw ServiceException.INVALID_REQUEST("Setting both zimbraFreebusyExchangeURL and zimbraFreebusyExternalZimbraURL is not allowed", null);
/*    */       }
/*    */     }
/*    */   }
/*    */   
/*    */   public void postModify(CallbackContext context, String attrName, Entry entry) {}
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/callback/FreeBusyProviderURLCheck.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */